HackerRank Common Child
解答
code: python
import math
import os
import random
import re
import sys
#
# Complete the 'commonChild' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. STRING s1
# 2. STRING s2
#
def commonChild(s1, s2):
l_s = len(s1)
dp = [0 * (l_s + 1) for i in range(l_s + 1)] for i in range(l_s):
for j in range(l_s):
else:
if __name__ == '__main__':
s1 = input()
s2 = input()
result = commonChild(s1, s2)
fptr.write(str(result) + '\n')
fptr.close()
テーマ
メモ
提出
code: python
import math
import os
import random
import re
import sys
#
# Complete the 'commonChild' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. STRING s1
# 2. STRING s2
#
# HARRY
# SALLY
# - Define start
# -- H not in SALLY O(len(s))
# -- A in SALLY O(len(s))
# --- ...
# O(len(s)) * O(len(s))
def commonChild(s1, s2):
# Write your code here
if __name__ == '__main__':
s1 = input()
s2 = input()
result = commonChild(s1, s2)
fptr.write(str(result) + '\n')
fptr.close()